/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package com.xiashitech.agent.instrumentation.redis.redisson.v317;

import com.xiashitech.agent.instrumentation.redis.RedisData;
import com.xiashitech.agent.instrumentation.redis.XSJedisAttributesExtractor;
import io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.SpanKindExtractor;
import io.opentelemetry.javaagent.shaded.io.opentelemetry.api.GlobalOpenTelemetry;

public final class XSRedissonSingletons {
  private static final String INSTRUMENTATION_NAME = "com.xiashitech.redisson-3.17";
  private static final String SPAN_NAME = "xs.redisson-3.17";
  private static final Instrumenter<RedisData, RedisData> INSTRUMENTER;

  public static Instrumenter<RedisData, RedisData> instrumenter() {
    return INSTRUMENTER;
  }

  static {
    INSTRUMENTER = Instrumenter.<RedisData, RedisData>builder(
                    GlobalOpenTelemetry.get(),
                    INSTRUMENTATION_NAME,
                    request -> SPAN_NAME)
            .addAttributesExtractor(new XSJedisAttributesExtractor())
            .buildInstrumenter(SpanKindExtractor.alwaysClient());
  }
  private XSRedissonSingletons() {}
}
